package cn.walls1717.juc.cas;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * 原子类测试
 *
 * @author walls1717
 * @create 2022/12/12 11:34
 **/
@Slf4j
public class CASDemo {

    public static void main(String[] args) {
        AtomicInteger atomicInteger = new AtomicInteger(5);
        log.info(atomicInteger.compareAndSet(5, 2022) + "  " + atomicInteger.get());
        log.info(atomicInteger.compareAndSet(5, 2022) + "  " + atomicInteger.get());
    }
}
